home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / tchar.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  28.1 KB  |  882 lines

  1. /*
  2.  *      C/C++ Run Time Library - Version 9.0
  3.  *
  4.  *      Copyright (c) 1995, 1998 by Borland International
  5.  *      All Rights Reserved.
  6.  *
  7.  */
  8. /* $Revision:   9.6  $ */
  9.  
  10. #if !defined(__TCHAR_H)
  11. #define __TCHAR_H
  12. #define _INC_TCHAR  /* MSC Guard name */
  13.  
  14. #ifndef ___STDDEF_H
  15. #include <_stddef.h>
  16. #endif
  17.  
  18.  
  19. #if defined(__USING_CNAME__)
  20. #  undef __USING_CNAME__
  21. #  include <string.h>
  22. #  define __USING_CNAME__
  23. #else
  24. #  include <string.h>
  25. #endif
  26.  
  27. #ifdef  __cplusplus
  28. extern "C" {
  29. #endif
  30.  
  31. #if defined(_MBCS) && !defined(__MBSTRING_H)
  32. #include <mbstring.h>
  33. #endif
  34.  
  35. #if !defined(_UNICODE)
  36.  
  37. #ifdef __cplusplus
  38. namespace std {
  39. #endif
  40.  
  41. /* Common functions between SBCS & MBCS */
  42. #ifndef __TCHAR_DEFINED
  43. typedef char            _TCHAR;
  44. typedef signed char     _TSCHAR;
  45. typedef unsigned char   _TUCHAR;
  46. typedef char            _TXCHAR;
  47. typedef int             _TINT;
  48. #define __TCHAR_DEFINED
  49. #endif
  50.  
  51. #ifdef __cplusplus
  52. } // std
  53. #endif
  54.  
  55. #define _tfdopen        _fdopen
  56. #define _fputtchar      _fputchar
  57. #define _fgettchar      _fgetchar
  58. #define _tmktemp        _mktemp
  59. #define _tunlink        _unlink
  60. #define _ttempnam       _tempnam
  61. #define _trmdir         _rmdir
  62. #define _tmkdir         _mkdir
  63. #define _tutime         _utime
  64. #define _ltot           _ltoa
  65. #define _tsopen         _sopen
  66.  
  67. /* program specific mappings*/
  68.  
  69. #define _tmain          main
  70. #define _tWinMain       WinMain
  71. #define _tenviron       _environ
  72. #define _targv          _argv
  73.  
  74. /*  Path / Environment  specific mappings  */
  75.  
  76. #define _tfullpath      _fullpath
  77. #define _tmakepath      _makepath
  78. #define _tsplitpath     _splitpath
  79. #define _tsearchpath    searchpath
  80. #define _tsearchenv     _searchenv
  81. #define _tsearchstr     _searchstr
  82. #define _tgetenv        getenv
  83. #define _tputenv        putenv
  84. #define _tfnsplit       fnsplit
  85. #define _tfnmerge       fnmerge
  86.  
  87. /* directory functions */
  88.  
  89. #define _topendir       opendir
  90. #define _treaddir       readdir
  91. #define _trewinddir     rewinddir
  92. #define _tclosedir      closedir
  93. #define _tDIR           DIR
  94. #define _tdirent        dirent
  95.  
  96. /* stdio functions   */
  97.  
  98. #define _tpopen         _popen
  99. #define _tfsopen        _fsopen
  100. #define _tfopen         fopen
  101. #define _tfreopen       freopen
  102. #define _tperror        perror
  103. #define _ttmpnam        tmpnam
  104.  
  105. /* Time functions     */
  106.  
  107. #define _tstrdate       _strdate
  108. #define _tstrtime       _strtime
  109. #define _tasctime       asctime
  110. #define _tctime         ctime
  111. #define _tcsftime       strftime
  112. #define _ttzset         _tzset
  113. #define _ttzname        _tzname
  114.  
  115. /*  I/O functions   */
  116.  
  117. #define _taccess        access
  118. #define _tchmod         chmod
  119. #define _trtl_open      _rtl_open
  120. #define _trtl_creat     _rtl_creat
  121. #define _trtl_chmod     _rtl_chmod
  122. #define _tcreat         creat
  123. #define _tfindfirst     findfirst
  124. #define _tfindnext      findnext
  125. #define _tfindclose     findclose
  126. #define _topen          open
  127. #define _tremove        remove
  128. #define _trename        rename
  129.  
  130. #define _tffblk         ffblk
  131.  
  132. /* string conversion functions */
  133.  
  134. #define _ttof           atof
  135. #define _ttoi           atoi
  136. #define _ttol           atol
  137. #define _ttoi64         _atoi64
  138. #define _ttold          _atold
  139. #define _tcstod         strtod
  140. #define _tcstol         strtol
  141. #define _tcstold        _strtold
  142. #define _tcstoul        strtoul
  143. #define _itot           itoa
  144. #define _ultot          ultoa
  145. #define _i64tot         _i64toa
  146. #define _ui64tot        _ui64toa
  147.  
  148. /* string functions  */
  149.  
  150. #define _tcscat         strcat
  151. #define _tcscpy         strcpy
  152. #define _tcspcpy        _stpcpy
  153. #define _tcslen         strlen
  154. #define _tcsdup         strdup
  155.  
  156. /* directory functions */
  157.  
  158. #define _tchdir         chdir
  159. #define _tgetcurdir     getcurdir
  160. #define _tgetcwd        getcwd
  161. #define _tgetdcwd       _getdcwd
  162.  
  163. /* Execute functions */
  164.  
  165. #define _texecl     execl
  166. #define _texecle    execle
  167. #define _texeclp    execlp
  168. #define _texeclpe   execlpe
  169. #define _texecv     execv
  170. #define _texecve    execve
  171. #define _texecvp    execvp
  172. #define _texecvpe   execvpe
  173.  
  174. #define _tspawnl    spawnl
  175. #define _tspawnle   spawnle
  176. #define _tspawnlp   spawnlp
  177. #define _tspawnlpe  spawnlpe
  178. #define _tspawnv    spawnv
  179. #define _tspawnve   spawnve
  180. #define _tspawnvp   spawnvp
  181. #define _tspawnvpe  spawnvpe
  182.  
  183. #define _tsystem    system
  184.  
  185. /* Unformated I/O */
  186.  
  187. #define _fgettc         fgetc
  188. #define _fgetts         fgets
  189. #define _fputtc         fputc
  190. #define _fputts         fputs
  191. #define _gettc          getc
  192. #define _gettchar       getchar
  193. #define _getts          gets
  194. #define _puttc          putc
  195. #define _puttchar       putchar
  196. #define _putts          puts
  197. #define _ungettc        ungetc
  198.  
  199. /* Formated I/O */
  200.  
  201. #define _ftprintf       fprintf
  202. #define _tprintf        printf
  203. #define _stprintf       sprintf
  204. #define _vtprintf       vprintf
  205. #define _vftprintf      vfprintf
  206. #define _vstprintf      vsprintf
  207.  
  208. #define _tscanf         scanf
  209. #define _stscanf        sscanf
  210. #define _ftscanf        fscanf
  211. #define _vstscanf       vsscanf
  212. #define _vtscanf        vscanf
  213. #define _vftscanf       vfscanf
  214.  
  215. /* Stat functions */
  216.  
  217. #define _tstat          _stat
  218. #define _tstati64       _stati64
  219.  
  220. /* Setlocale functions */
  221.  
  222. #define _tsetlocale setlocale
  223.  
  224. /* memory functions */
  225.  
  226. #define _tmemcpy        memcpy
  227. #define _tmemchr        memchr
  228. #define _tmemset        memset
  229.  
  230. /* Generic Text macros */
  231.  
  232. #define __T(__x)          __x
  233. #define _TEXT(__x)        __T(__x)
  234. #define _T(__x)           __T(__x)
  235. #define _TEOF           EOF
  236.  
  237. #if defined(_MBCS)
  238.  
  239. /* ----------------- MBCS functions -------------------------- */
  240.  
  241. #ifdef __cplusplus
  242. namespace std {
  243. #endif
  244.  
  245. #ifndef __TCHAR_DEFINED
  246. typedef char            _TCHAR;
  247. typedef signed char     _TSCHAR;
  248. typedef unsigned char   _TUCHAR;
  249. typedef unsigned char   _TXCHAR;
  250. typedef unsigned int    _TINT;
  251. #define __TCHAR_DEFINED
  252. #endif
  253.  
  254. #ifdef __cplusplus
  255. } // std
  256. #endif
  257.  
  258. #ifdef _MBC_USE_MACROS
  259. /* string functions */
  260.  
  261. #define _tcschr         _mbschr
  262. #define _tcscspn        _mbscspn
  263. #define _tcsncat        _mbsnbcat
  264. #define _tcsncpy        _mbsnbcpy
  265. #define _tcspbrk        _mbspbrk
  266. #define _tcsrchr        _mbsrchr
  267. #define _tcsspn         _mbsspn
  268. #define _tcsstr         _mbsstr
  269. #define _tcstok         _mbstok
  270.  
  271. #define _tcsset         _mbsset
  272. #define _tcsnset        _mbsnbset
  273. #define _tcsrev         _mbsrev
  274. #define _tcscmp         _mbscmp
  275. #define _tcsicmp        _mbsicmp
  276. #define _tcsncmp        _mbsnbcmp
  277. #define _tcsnicmp       _mbsnbicmp
  278. #define _tcsnccmp       _mbsncmp
  279. #define _tcsncicmp      _mbsnicmp
  280.  
  281. /* todo : correct the mapping of these functions and add the new functions */
  282. #define _tcscoll        _mbscoll
  283. #define _tcsncoll       _mbsnbcoll
  284. #define _tcsnccoll      _mbsncoll
  285. #define _tcsicoll       _mbsicoll
  286. #define _tcsnicoll      _mbsnbicoll
  287. #define _tcsncicoll     _mbsnicoll
  288.  
  289. /* logical-character mappings */
  290.  
  291. #define _tcsclen        _mbslen
  292. #define _tcsnccat       _mbsncat
  293. #define _tcsnccpy       _mbsncpy
  294. #define _tcsncset       _mbsnset
  295.  
  296. /* MBCS specific mappings */
  297.  
  298. #define _tcsdec         _mbsdec
  299. #define _tcsinc         _mbsinc
  300. #define _tcsnbcnt       _mbsnbcnt
  301. #define _tcsnccnt       _mbsnccnt
  302. #define _tcsnextc       _mbsnextc
  303. #define _tcsninc        _mbsninc
  304. #define _tcsspnp        _mbsspnp
  305.  
  306. #define _tcslwr         _mbslwr
  307. #define _tcsupr         _mbsupr
  308.  
  309. #define _tclen          _mbclen
  310. #define _tccpy          _mbccpy
  311. #define _tccmp(__a,__b) _mbsncmp(__a,__b,1)
  312.  
  313. #else /* _MBC_USE_MACROS */
  314.  
  315. #if (!defined ( __cplusplus) || defined( _NO_INLINING ))
  316.  
  317. /* String functions */
  318.  
  319. char * _RTLENTRY  _EXPFUNC _tcschr(const char *, unsigned int);
  320. _SIZE_T _RTLENTRY  _EXPFUNC _tcscspn(const char *, const char *);
  321. char * _RTLENTRY  _EXPFUNC _tcsncat(char *, const char *, _SIZE_T);
  322. char * _RTLENTRY  _EXPFUNC _tcsncpy(char *, const char *, _SIZE_T);
  323. char * _RTLENTRY  _EXPFUNC _tcspbrk(const char *, const char *);
  324. char * _RTLENTRY  _EXPFUNC _tcsrchr(const char *, int);
  325. _SIZE_T _RTLENTRY  _EXPFUNC _tcsspn(const char *, const char *);
  326. char * _RTLENTRY  _EXPFUNC _tcsstr(const char *, const char *);
  327. char * _RTLENTRY  _EXPFUNC _tcstok(char *, const char *);
  328.  
  329. char * _RTLENTRY  _EXPFUNC _tcsnset(char *, unsigned int, _SIZE_T);
  330. char * _RTLENTRY  _EXPFUNC _tcsrev(char *);
  331. char * _RTLENTRY  _EXPFUNC _tcsset(char *, unsigned int);
  332.  
  333. int _RTLENTRY  _EXPFUNC _tcscmp(const char *, const char *);
  334. int _RTLENTRY  _EXPFUNC _tcsicmp(const char *, const char *);
  335. int _RTLENTRY  _EXPFUNC _tcsnccmp(const char *, const char *, _SIZE_T);
  336. int _RTLENTRY  _EXPFUNC _tcsncmp(const char *, const char *, _SIZE_T);
  337. int _RTLENTRY  _EXPFUNC _tcsncicmp(const char *, const char *, _SIZE_T);
  338. int _RTLENTRY  _EXPFUNC _tcsnicmp(const char *, const char *, _SIZE_T);
  339.  
  340. int _RTLENTRY  _EXPFUNC _tcscoll(const char *, const char *);
  341. int _RTLENTRY  _EXPFUNC _tcsicoll(const char *, const char *);
  342. int _RTLENTRY  _EXPFUNC _tcsnccoll(const char *, const char *, _SIZE_T);
  343. int _RTLENTRY  _EXPFUNC _tcsncoll(const char *, const char *, _SIZE_T);
  344. int _RTLENTRY  _EXPFUNC _tcsncicoll(const char *, const char *, _SIZE_T);
  345. int _RTLENTRY  _EXPFUNC _tcsnicoll(const char *, const char *, _SIZE_T);
  346.  
  347.  
  348. /* "logical-character" mappings */
  349.  
  350. _SIZE_T _RTLENTRY  _EXPFUNC _tcsclen(const char *);
  351. char * _RTLENTRY  _EXPFUNC _tcsnccat(char *, const char *, _SIZE_T);
  352. char * _RTLENTRY  _EXPFUNC _tcsnccpy(char *, const char *, _SIZE_T);
  353. char * _RTLENTRY  _EXPFUNC _tcsncset(char *, unsigned int, _SIZE_T);
  354.  
  355.  
  356. /* MBCS-specific mappings */
  357.  
  358. char * _RTLENTRY  _EXPFUNC _tcsdec(const char *, const char *);
  359. char * _RTLENTRY  _EXPFUNC _tcsinc(const char *);
  360. _SIZE_T _RTLENTRY  _EXPFUNC _tcsnbcnt(const char *, _SIZE_T);
  361. _SIZE_T _RTLENTRY  _EXPFUNC _tcsnccnt(const char *, _SIZE_T);
  362. unsigned int _RTLENTRY  _EXPFUNC _tcsnextc (const char *);
  363. char * _RTLENTRY  _EXPFUNC _tcsninc(const char *, _SIZE_T);
  364. char * _RTLENTRY  _EXPFUNC _tcsspnp(const char *, const char *);
  365.  
  366. char * _RTLENTRY  _EXPFUNC _tcslwr(char *);
  367. char * _RTLENTRY  _EXPFUNC _tcsupr(char *);
  368.  
  369. _SIZE_T _RTLENTRY  _EXPFUNC _tclen(const char *);
  370. void   _RTLENTRY  _EXPFUNC _tccpy(char *, const char *);
  371. int    _RTLENTRY  _EXPFUNC _tccmp(const char *, const char *);
  372.  
  373. #else  /* (!defined( __cplusplus) || defined( _NO_INLINING )) */
  374.  
  375. inline char * _tcschr(const char * __s1,unsigned int __c) {return (char *)_mbschr((const unsigned char *)__s1,__c);}
  376. inline _SIZE_T _tcscspn(const char * __s1,const char * __s2) {return _mbscspn((const unsigned char *)__s1,(const unsigned char *)__s2);}
  377. inline char * _tcsncat(char * __s1,const char * __s2,_SIZE_T __n) {return (char *)_mbsnbcat((unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  378. inline char * _tcsncpy(char * __s1,const char * __s2,_SIZE_T __n) {return (char *)_mbsnbcpy((unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  379. inline char * _tcspbrk(const char * __s1,const char * __s2) {return (char *)_mbspbrk((const unsigned char *)__s1,(const unsigned char *)__s2);}
  380. inline char * _tcsrchr(const char * __s1,unsigned int __c) {return (char *)_mbsrchr((const unsigned char *)__s1,__c);}
  381. inline _SIZE_T _tcsspn(const char * __s1,const char * __s2) {return _mbsspn((const unsigned char *)__s1,(const unsigned char *)__s2);}
  382. inline char * _tcsstr(const char * __s1,const char * __s2) {return (char *)_mbsstr((const unsigned char *)__s1,(const unsigned char *)__s2);}
  383. inline char * _tcstok(char * __s1,const char * __s2) {return (char *)_mbstok((unsigned char *)__s1,(const unsigned char *)__s2);}
  384.  
  385. inline char * _tcsnset(char * __s1,unsigned int __c,_SIZE_T __n) {return (char *)_mbsnbset((unsigned char *)__s1,__c,__n);}
  386. inline char * _tcsrev(char * __s1) {return (char *)_mbsrev((unsigned char *)__s1);}
  387. inline char * _tcsset(char * __s1,unsigned int __c) {return (char *)_mbsset((unsigned char *)__s1,__c);}
  388.  
  389. inline int _tcscmp(const char * __s1,const char * __s2) {return _mbscmp((const unsigned char *)__s1,(const unsigned char *)__s2);}
  390. inline int _tcsicmp(const char * __s1,const char * __s2) {return _mbsicmp((const unsigned char *)__s1,(const unsigned char *)__s2);}
  391. inline int _tcsnccmp(const char * __s1,const char * __s2,_SIZE_T __n) {return _mbsncmp((const unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  392. inline int _tcsncmp(const char * __s1,const char * __s2,_SIZE_T __n) {return _mbsnbcmp((const unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  393. inline int _tcsncicmp(const char * __s1,const char * __s2,_SIZE_T __n) {return _mbsnicmp((const unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  394. inline int _tcsnicmp(const char * __s1,const char * __s2,_SIZE_T __n) {return _mbsnbicmp((const unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  395.  
  396. inline int _tcscoll(const char * __s1,const char * __s2) {return _mbscoll((const unsigned char *)__s1,(const unsigned char *)__s2);}
  397. inline int _tcsicoll(const char * __s1,const char * __s2) {return _mbsicoll((const unsigned char *)__s1,(const unsigned char *)__s2);}
  398. inline int _tcsnccoll(const char * __s1,const char * __s2,_SIZE_T __n) {return _mbsncoll((const unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  399. inline int _tcsncoll(const char * __s1,const char * __s2,_SIZE_T __n) {return _mbsnbcoll((const unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  400. inline int _tcsncicoll(const char * __s1,const char * __s2,_SIZE_T __n) {return _mbsnicoll((const unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  401. inline int _tcsnicoll(const char * __s1,const char * __s2,_SIZE_T __n) {return _mbsnbicoll((const unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  402.  
  403.  
  404. /* logical-character mappings */
  405.  
  406. inline _SIZE_T _tcsclen(const char * __s1) {return _mbslen((const unsigned char *)__s1);}
  407. inline char * _tcsnccat(char * __s1,const char * __s2,_SIZE_T __n) {return (char *)_mbsncat((unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  408. inline char * _tcsnccpy(char * __s1,const char * __s2,_SIZE_T __n) {return (char *)_mbsncpy((unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  409. inline char * _tcsncset(char * __s1,unsigned int __c,_SIZE_T __n) {return (char *)_mbsnset((unsigned char *)__s1,__c,__n);}
  410.  
  411.  
  412. /* MBCS-specific mappings */
  413.  
  414. inline char * _tcsdec(const char * __s1,const char * __s2) {return (char *)_mbsdec((const unsigned char *)__s1,(const unsigned char *)__s2);}
  415. inline char * _tcsinc(const char * __s1) {return (char *)_mbsinc((const unsigned char *)__s1);}
  416. inline _SIZE_T _tcsnbcnt(const char * __s1,_SIZE_T __n) {return _mbsnbcnt((const unsigned char *)__s1,__n);}
  417. inline _SIZE_T _tcsnccnt(const char * __s1,_SIZE_T __n) {return _mbsnccnt((const unsigned char *)__s1,__n);}
  418.  
  419. inline unsigned int _tcsnextc(const char * __s1)
  420. {
  421.    unsigned int __n=0;
  422.    if (_ismbblead((unsigned int)*(unsigned char *)__s1))
  423.        __n=((unsigned int)*__s1++)<<8;
  424.    else
  425.        __s1++;
  426.    if (_ismbblead((unsigned int)*(unsigned char *)__s1))
  427.        __n=((unsigned int)*__s1++)<<8;
  428.  
  429.    __n+=(unsigned int)*__s1;
  430.    return(__n);
  431. }
  432.  
  433. inline char * _tcsninc(const char * __s1,_SIZE_T __n) {return (char *)_mbsninc((const unsigned char *)__s1,__n);}
  434. inline char * _tcsspnp(const char * __s1,const char * __s2) {return (char *)_mbsspnp((const unsigned char *)__s1,(const unsigned char *)__s2);}
  435. inline char * _tcslwr(char * __s1) {return (char *)_mbslwr((unsigned char *)__s1);}
  436. inline char * _tcsupr(char * __s1) {return (char *)_mbsupr((unsigned char *)__s1);}
  437.  
  438. inline _SIZE_T _tclen(const char * __s1) {return _mbclen((const unsigned char *)__s1);}
  439. inline void   _tccpy(char * __s1,const char * __s2) {_mbccpy((unsigned char *)__s1,(const unsigned char *)__s2); return;}
  440. inline int    _tccmp(const char *__s1, const char *__s2){ return  _mbsncmp((const unsigned char *)__s1,(const unsigned char *)__s2,1);}
  441.  
  442. #endif  /* (!defined ( __cplusplus) || defined( _NO_INLINING )) */
  443.  
  444. #endif  /* _MBC_USE_MACROS */
  445.  
  446. #define _tcscmpi        _tcsicmp
  447. #define _tcsncmpi       _tcsnicmp
  448.  
  449. /* ctype functions */
  450. #define _istalnum       _ismbcalnum
  451. #define _istalpha       _ismbcalpha
  452. #define _istdigit       _ismbcdigit
  453. #define _istgraph       _ismbcgraph
  454. #define _istlower       _ismbclower
  455. #define _istprint       _ismbcprint
  456. #define _istpunct       _ismbcpunct
  457. #define _istspace       _ismbcspace
  458. #define _istupper       _ismbcupper
  459. #define _istlegal       _ismbclegal
  460.  
  461. #define _totlower       _mbctolower
  462. #define _totupper       _mbctoupper
  463.  
  464. #define _istlead        _ismbblead
  465. #define _istleadbyte    _ismbblead
  466.  
  467. #else  /* _MBCS */
  468.  
  469. /* ------------------- SBCS functions ----------------------- */
  470.  
  471.  
  472. /* string functions */
  473.  
  474. #define _tcschr         strchr
  475. #define _tcscspn        strcspn
  476. #define _tcsncpy        strncpy
  477. #define _tcsncat        strncat
  478. #define _tcspbrk        strpbrk
  479. #define _tcsrchr        strrchr
  480. #define _tcsspn         strspn
  481. #define _tcsstr         strstr
  482. #define _tcstok         strtok
  483.  
  484. #define _tcsnset        strnset
  485. #define _tcsrev         strrev
  486. #define _tcsset         strset
  487.  
  488. #define _tcscmp         strcmp
  489. #define _tcsicmp        stricmp
  490. #define _tcsnccmp       strncmp
  491. #define _tcsncmp        strncmp
  492. #define _tcsncicmp      strnicmp
  493. #define _tcsnicmp       strnicmp
  494. #define _tcscmpi        strcmpi
  495. #define _tcsncmpi       strncmpi
  496.  
  497. #define _tcscoll        strcoll
  498. #define _tcsicoll       _stricoll
  499. #define _tcsnccoll      _strncoll
  500. #define _tcsncoll       _strncoll
  501. #define _tcsncicoll     _strnicoll
  502. #define _tcsnicoll      _strnicoll
  503. #define _tcsxfrm        strxfrm
  504.  
  505. #define _ltcscoll       _lstrcoll
  506. #define _ltcsicoll      _lstricoll
  507. #define _ltcsnccoll     _lstrncoll
  508. #define _ltcsncoll      _lstrncoll
  509. #define _ltcsncicoll    _lstrnicoll
  510. #define _ltcsnicoll     _lstrnicoll
  511. #define _ltcsxfrm       _lstrxfrm
  512.  
  513. /* MBCS specific functions */
  514.  
  515. #define _tcsdec         _strdec
  516. #define _tcsinc         _strinc
  517. #define _tcsnbcnt       _strncnt
  518. #define _tcsnccnt       _strncnt
  519. #define _tcsnextc       _strnextc
  520. #define _tcsninc        _strninc
  521. #define _tcsspnp        _strspnp
  522.  
  523. #define _tcslwr         strlwr
  524. #define _tcsupr         strupr
  525.  
  526. #define _istlegal(__a)    (1)
  527. #define _istlead(__a)     (0)
  528. #define _istleadbyte(__a) (0)
  529.  
  530.  
  531. #if (!defined ( __cplusplus) || defined( _NO_INLINING ))
  532.  
  533. #define _tclen(__a)       (1)
  534. #define _tccpy(__a,__b)     ((*(__a))=(*(__b)))
  535. #define _tccmp(__a,__b)     ((*(__a))-(*(__b)))
  536.  
  537. #else  /* (!defined ( __cplusplus) || defined( _NO_INLINING )) */
  538.  
  539. inline _SIZE_T _RTLENTRY _tclen(const char *__s ){return (1); }
  540. inline void   _RTLENTRY _tccpy(char *__s1, const char *__s2) {*(__s1) = *(__s2); }
  541. inline int    _RTLENTRY _tccmp(const char *__s1, const char *__s2){ return (int) ( ((unsigned char*)__s1)-((unsigned char*)__s2)); }
  542.  
  543. #endif  /* (!defined ( __cplusplus) || defined( _NO_INLINING )) */
  544.  
  545. /* logical-character mappings */
  546.  
  547. #define _tcsclen        strlen
  548. #define _tcsnccat       strncat
  549. #define _tcsnccpy       strncpy
  550. #define _tcsncset       strnset
  551.  
  552. /* ctype functions */
  553.  
  554. #define _istalnum       isalnum
  555. #define _istalpha       isalpha
  556. #define _istdigit       isdigit
  557. #define _istgraph       isgraph
  558. #define _istlower       islower
  559. #define _istprint       isprint
  560. #define _istpunct       ispunct
  561. #define _istspace       isspace
  562. #define _istupper       isupper
  563. #define _istascii       isascii
  564. #define _istcntrl       iscntrl
  565. #define _istxdigit      isxdigit
  566.  
  567. #define _totlower       tolower
  568. #define _totupper       toupper
  569.  
  570. #if (!defined (__cplusplus) || defined( _NO_INLINING ))
  571.  
  572. #define _strinc(__a)       ((__a)+1)
  573. #define _strdec(__a, __b)    ((__b)-1)
  574. #define _strnextc(__a)     ((unsigned int) ((__a) ? (__a)[1] : 0))
  575. #define _strninc(__a, __b)   ((__a)+(__b))
  576. #define _strncnt(__a, __b)   ((strlen(__a)>__b) ? __b : strlen(__a))
  577. #define _strspnp(__a, __b)   ((*((__a)+strspn(__a,__b))) ? ((__a)+strspn(__a,__b)) : NULL)
  578.  
  579. #else  /* (!defined( __cplusplus) || defined( _NO_INLINING )) */
  580.  
  581. inline char * _RTLENTRY strinc(const char * __s) { return (char *)(__s+1); }
  582. inline char * _RTLENTRY strdec(const char * __s1, const char * __s2) { return (char *)(__s1,(__s2-1)); }
  583.  
  584. inline char * _RTLENTRY _strinc(const char * __s) { return (char *)(__s+1); }
  585. inline char * _RTLENTRY _strdec(const char * __s1, const char * __s2) { return (char *)(__s1,(__s2-1)); }
  586. inline unsigned int _RTLENTRY _strnextc(const char *__s) { return (unsigned int) (__s ? __s[1] : 0); }
  587. inline char * _RTLENTRY _strninc(const char * __s, _SIZE_T __n) { return (char *)(__s+__n); }
  588. inline _SIZE_T _RTLENTRY _strncnt( const char * __s, _SIZE_T __n) { _SIZE_T __len; __len = strlen(__s); return (__len>__n) ? __n : __len; }
  589. inline char * _RTLENTRY _strspnp( const char * __s1, const char * __s2) { return (*(__s1 += strspn(__s1,__s2))!='\0') ? (char*)__s1 : NULL; }
  590.  
  591. #endif /* (!defined (__cplusplus) || defined( _NO_INLINING )) */
  592.  
  593. #endif /* _MBCS */
  594.  
  595. #else  /* _UNICODE */
  596.  
  597. #ifdef __cplusplus
  598. namespace std {
  599. #endif
  600.  
  601. #ifndef __TCHAR_DEFINED
  602. typedef wchar_t         _TCHAR;
  603. typedef wchar_t         _TSCHAR;
  604. typedef wchar_t         _TUCHAR;
  605. typedef wchar_t         _TXCHAR;
  606. typedef _WINT_T          _TINT;
  607. #define __TCHAR_DEFINED
  608. #endif
  609.  
  610. #ifdef __cplusplus
  611. } // std
  612. #endif
  613.  
  614. #define _TEOF           WEOF
  615. #define __T(__x)          L ## __x
  616. #define _TEXT(__x)        __T(__x)
  617. #define _T(__x)           __T(__x)
  618.  
  619. /* string functions */
  620.  
  621. #define _tcschr         wcschr
  622. #define _tcscspn        wcscspn
  623. #define _tcsncpy        wcsncpy
  624. #define _tcsncat        wcsncat
  625. #define _tcspbrk        wcspbrk
  626. #define _tcsrchr        wcsrchr
  627. #define _tcsspn         wcsspn
  628. #define _tcsstr         wcsstr
  629. #define _tcstok         wcstok
  630. #define _tcsnset        _wcsnset
  631. #define _tcsrev         _wcsrev
  632. #define _tcsset         _wcsset
  633. #define _tcscmp         wcscmp
  634. #define _tcsicmp        _wcsicmp
  635. #define _tcsnccmp       wcsncmp
  636. #define _tcsncmp        wcsncmp
  637. #define _tcsnicmp       _wcsnicmp
  638. #define _tcsncicmp      _wcsnicmp
  639. #define _tcscmpi        wcscmpi
  640. #define _tcsncmpi       wcsncmpi
  641. #define _tcscat         wcscat
  642. #define _tcscpy         wcscpy
  643. #define _tcspcpy        _wcspcpy
  644. #define _tcslen         wcslen
  645. #define _tcsdup         _wcsdup
  646. #define _tcslwr         _wcslwr
  647. #define _tcsupr         _wcsupr
  648.  
  649. #define _tcsdec         _wcsdec
  650. #define _tcsinc         _wcsinc
  651. #define _tcsnbcnt       _wcsncnt
  652. #define _tcsnccnt       _wcsncnt
  653. #define _tcsnextc       _wcsnextc
  654. #define _tcsninc        _wcsninc
  655. #define _tcsspnp        _wcsspnp
  656.  
  657. #define _tcscoll        wcscoll
  658. #define _tcsicoll       _wcsicoll
  659. #define _tcsnccoll      _wcsncoll
  660. #define _tcsncoll       _wcsncoll
  661. #define _tcsncicoll     _wcsnicoll
  662. #define _tcsnicoll      _wcsnicoll
  663. #define _tcsxfrm        wcsxfrm
  664.  
  665. #define _ltcscoll       _lwcscoll
  666. #define _ltcsicoll      _lwcsicoll
  667. #define _ltcsnccoll     _lwcsncoll
  668. #define _ltcsncoll      _lwcsncoll
  669. #define _ltcsncicoll    _lwcsnicoll
  670. #define _ltcsnicoll     _lwcsnicoll
  671. #define _ltcsxfrm       _lwcsxfrm
  672.  
  673. /* time functions */
  674.  
  675. #define _tasctime       _wasctime
  676. #define _tutime         _wutime
  677. #define _tctime         _wctime
  678. #define _tstrdate       _wstrdate
  679. #define _tstrtime       _wstrtime
  680. #define _tcsftime       wcsftime
  681. #define _ttzset         _wtzset
  682. #define _ttzname        _wtzname
  683.  
  684. /* ctype functions */
  685.  
  686. #define _istalnum       iswalnum
  687. #define _istalpha       iswalpha
  688. #define _istdigit       iswdigit
  689. #define _istgraph       iswgraph
  690. #define _istlower       iswlower
  691. #define _istprint       iswprint
  692. #define _istpunct       iswpunct
  693. #define _istspace       iswspace
  694. #define _istupper       iswupper
  695. #define _istascii       iswascii
  696. #define _istcntrl       iswcntrl
  697. #define _istxdigit      iswxdigit
  698.  
  699. #define _istlegal(__a)    (1)
  700. #define _istlead(__a)     (0)
  701. #define _istleadbyte(__a) (0)
  702.  
  703. #define _totlower       towlower
  704. #define _totupper       towupper
  705.  
  706. /* Execute functions */
  707.  
  708. #define _texecl     _wexecl
  709. #define _texecle    _wexecle
  710. #define _texeclp    _wexeclp
  711. #define _texeclpe   _wexeclpe
  712. #define _texecv     _wexecv
  713. #define _texecve    _wexecve
  714. #define _texecvp    _wexecvp
  715. #define _texecvpe   _wexecvpe
  716.  
  717. #define _tspawnl    _wspawnl
  718. #define _tspawnle   _wspawnle
  719. #define _tspawnlp   _wspawnlp
  720. #define _tspawnlpe  _wspawnlpe
  721. #define _tspawnv    _wspawnv
  722. #define _tspawnve   _wspawnve
  723. #define _tspawnvp   _wspawnvp
  724. #define _tspawnvp   _wspawnvp
  725. #define _tspawnvpe  _wspawnvpe
  726.  
  727. #define _tsystem        _wsystem
  728.  
  729. /*  Path / Environment  specific mappings  */
  730.  
  731. #define _tfullpath      _wfullpath
  732. #define _tsplitpath     _wsplitpath
  733. #define _tfnsplit       _wfnsplit
  734. #define _tfnmerge       _wfnmerge
  735. #define _tmakepath      _wmakepath
  736. #define _tsearchpath    wsearchpath
  737. #define _tsearchenv     _wsearchenv
  738. #define _tsearchstr     _wsearchstr
  739. #define _tgetenv        _wgetenv
  740. #define _tputenv        _wputenv
  741.  
  742. /*  I/O functions   */
  743.  
  744. #define _taccess        _waccess
  745. #define _tchmod         _wchmod
  746. #define _trtl_open      _wrtl_open
  747. #define _trtl_creat     _wrtl_creat
  748. #define _trtl_chmod     _wrtl_chmod
  749. #define _tcreat         _wcreat
  750. #define _tfindfirst     _wfindfirst
  751. #define _tfindnext      _wfindnext
  752. #define _tfindclose     _wfindclose
  753. #define _tmktemp        _wmktemp
  754. #define _topen          _wopen
  755. #define _tremove        _wremove
  756. #define _trename        _wrename
  757. #define _tsopen         _wsopen
  758. #define _tunlink        _wunlink
  759.  
  760. #define _tffblk         _wffblk
  761.  
  762. /* directory functions */
  763.  
  764. #define _topendir       wopendir
  765. #define _treaddir       wreaddir
  766. #define _trewinddir     wrewinddir
  767. #define _tclosedir      wclosedir
  768. #define _tDIR           wDIR
  769. #define _tdirent        wdirent
  770.  
  771. /* stdio functions   */
  772.  
  773. #define _tpopen         _wpopen
  774. #define _tfopen         _wfopen
  775. #define _tfsopen        _wfsopen
  776. #define _tfreopen       _wfreopen
  777. #define _tfdopen        _wfdopen
  778. #define _tperror        _wperror
  779. #define _ttmpnam        _wtmpnam
  780. #define _ttempnam       _wtempnam
  781.  
  782. /* program specific mappings*/
  783.  
  784. #define _tmain          wmain
  785. #define _tWinMain       wWinMain
  786. #define _tenviron       _wenviron
  787. #define _targv          _wargv
  788.  
  789. /* Directory functions */
  790.  
  791. #define _tchdir     _wchdir
  792. #define _tgetcurdir _wgetcurdir
  793. #define _tgetcwd    _wgetcwd
  794. #define _tgetdcwd   _wgetdcwd
  795. #define _tmkdir     _wmkdir
  796. #define _trmdir     _wrmdir
  797.  
  798. /* string conversion functions */
  799.  
  800. #define _ttof           _wtof
  801. #define _ttoi           _wtoi
  802. #define _ttol           _wtol
  803. #define _ttoi64         _wtoi64
  804. #define _ttold          _wtold
  805. #define _tcstod         wcstod
  806. #define _tcstol         wcstol
  807. #define _tcstold        _wcstold
  808. #define _tcstoul        wcstoul
  809. #define _itot           _itow
  810. #define _ltot           _ltow
  811. #define _ultot          _ultow
  812. #define _i64tot         _i64tow
  813. #define _ui64tot        _ui64tow
  814.  
  815. /* Stat functions */
  816.  
  817. #define _tstat          _wstat
  818. #define _tstati64       _wstati64
  819.  
  820. /* Setlocale functions */
  821.  
  822. #define _tsetlocale _wsetlocale
  823.  
  824. /* memory functions */
  825.  
  826. #define _tmemcpy        _wmemcpy
  827. #define _tmemchr        _wmemchr
  828. #define _tmemset        _wmemset
  829.  
  830. /* Unformated I/O */
  831.  
  832. #define _fgettc         fgetwc
  833. #define _gettc          getwc
  834. #define _fputtc         fputwc
  835. #define _puttc          putwc
  836. #define _fgettchar      _fgetwchar
  837. #define _fgetts         fgetws
  838. #define _fputtchar      _fputwchar
  839. #define _puttchar       putwchar
  840. #define _getts          _getws
  841. #define _fputts         fputws
  842. #define _gettchar       getwchar
  843. #define _putts          _putws
  844. #define _ungettc        ungetwc
  845.  
  846. /* Formated I/O */
  847. #define _tprintf        wprintf
  848. #define _vstprintf      vswprintf
  849. #define _stprintf       swprintf
  850. #define _ftprintf       fwprintf
  851. #define _vftprintf      vfwprintf
  852. #define _vtprintf       vwprintf
  853.  
  854.  
  855. #define _tscanf         wscanf
  856. #define _stscanf        swscanf
  857. #define _vstscanf       vswscanf
  858. #define _vtscanf        vwscanf
  859. #define _vftscanf       vfwscanf
  860. #define _ftscanf        fwscanf
  861.  
  862.  
  863. #define _wcsinc(__a)       ((__a)+1)
  864. #define _wcsdec(__a, __b)    ((__b)-1)
  865. #define _wcsnextc(__a)     ((wchar_t) ((__a) ? (__a)[1] : 0))
  866. #define _wcsninc(__a, __b)   ((__a)+(__b))
  867. #define _wcsncnt(__a, __b)   ((wcslen(__a)>__b) ? __b : wcslen(__a))
  868. #define _wcsspnp(__a, __b)   ((*((__a)+wcsspn(__a,__b))) ? ((__a)+wcsspn(__a,__b)) : NULL)
  869.  
  870. #endif /* _UNCODE */
  871.  
  872. #ifdef __cplusplus
  873. }
  874.     using std::_TCHAR;
  875.     using std::_TSCHAR;
  876.     using std::_TUCHAR;
  877.     using std::_TXCHAR;
  878.     using std::_TINT;
  879. #endif
  880.  
  881. #endif  /* __TCHAR_H */
  882.